import { GoodsList, GoodsQuery } from '@/types/goods'
import { request } from '@/utils/request'

export const getGoodsList = (data: GoodsQuery) => {
  return request<{ total: number; items: GoodsList[] }>({
    url: 'pro/list',
    data
  })
}
export const getCategories = () => {
  return request<string[]>({
    url: 'pro/getCategory'
  })
}

export const setState = (data: {
  proid: string
  state: 0 | 1
  type: 'issale' | 'isseckill' | 'isrecommend'
}) => {
  return request({
    url: 'pro/updateFlag',
    method: 'POST',
    data
  })
}
